package com.kfm.base.ex;

public class Demo03 {

    public static void main(String[] args) {

//        int i = 1 / 0;

        int result = 0;
        Object obj = null;
        try{
            obj.equals("A");
            result = 1 / 0;

        } catch (NullPointerException ex){
            // 对 NullPointerException 处理
            System.out.println("空指针");
        } catch (ArithmeticException ex){
            // 对 ArithmeticException 处理
        } catch (Throwable ex) { // 异常对象 instanceof catchType
            // Throwable ex = new NullPointerException();
            System.out.println(ex);

            System.out.println("抓住异常了");
        }

        System.out.println("end");
    }
}
